<?php
namespace app\index\controller;
use think\Db;
class Index extends Base{
    public function index(){
        $banners=Db::name('banner')->where('state',1)->order('sort desc')->select();
        $company=Db::name('company')->where('state',1)->order('id asc')->find();
    	$scenic_spots=Db::name('scenic_spot')->where('state',1)->order('stars desc')->limit(6)->select();
        $map = [
            ['state', '=', 1],
            ['type', '=', 1]
        ];
    	$news_type1=Db::name('news')->where($map)->order('id desc')->limit(1)->select();
        $map = [
            ['state', '=', 1],
            ['type', '=', 2]
        ];
    	$news_type2=Db::name('news')->where($map)->order('id desc')->limit(3)->select();
        $this->assign('news_type1',$news_type1);
        $this->assign('news_type2',$news_type2);
        $this->assign('system',$this->system_set());
        $this->assign('banners',$banners);
        $this->assign('company',$company);
        $this->assign('scenic_spots',$scenic_spots);
        return $this->fetch();
    }
}
